package com.ats.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.ats.model.User;
import com.ats.service.FindInfoService_cl;
import com.ats.serviceimpl.FindInfoServiceImpl_cl;

import net.sf.json.JSONArray;

public class FindInfoController_cl extends HttpServlet {
	FindInfoService_cl fo = new FindInfoServiceImpl_cl();

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		HttpSession session = req.getSession();
		resp.setCharacterEncoding("utf8");
		PrintWriter pw = resp.getWriter();
		int iid = ((User) session.getAttribute("user")).getIid();
		JSONArray arr = fo.FindInfoByIid(iid);
		pw.write(arr.toString());

	}
}
